#include "view_time_18.h"
#include "view_time_15.h"
#include "view_time_18.inc"
#include "view_time_14.h"
#include "view_time_3.h"
#include "view_time_0.h"
#include "display_ctrl.h"
#include "platform_assert.h"
#include "lfs_file_manager_auto.h"
#include "rtc.h"
#include "datetime.h"
#include "blecom.h"
#include "battery_ctrl.h"
#include "sport_his.h"
#include "display_ctrl.h"
#include "display_interface_240x240.h"
#include "datetime.h"
#include "heart_rate_interface.h"
#include "font/num_font.h"
#include "font_mngr.h"
#include "view_common.h"
#include "app_trace.h"
#include "view_times.h"
#include "math.h"
#include "weather_ctrl.h"
#include "health_storage.h"
#include "app_trace.h"
#define LOG(fmt, ...) app_trace_log(fmt "\r\n", ##__VA_ARGS__)
#ifdef TIME_18_SKIP
#else
void view_time_18_display(void)
{
    int steps = disp_ctrl.com_data.i_temp[11];
    int heart_rate = disp_ctrl.com_data.i_temp[17];
    float temperature = disp_ctrl.com_data.f_temp[26]; // wrist
// #warning debug
//     steps = 99999;
//     heart_rate = 130;
//     temperature = 37;
    // body 26;
    show_time_0_ble();
    show_time_0_battery(disp_ctrl.com_data.i_temp[7], disp_ctrl.com_data.i_temp[8]);
    show_time_3_date();
    show_time_3_weather();
    show_time_3_time();
    show_time_3_weeks();
    _disp_show_flash_img(DISP_LFS_FILE_INDEX_4, 179, 34, FILE_IMG_back_179_34);

    disp_draw_user_image_num_mid_filter_color(208, 70, steps, 8, num_7x10_TAB);
    if (heart_rate == 0)
    {
        int x1 = 201;
        disp_draw_rect_color(x1, 142 + 5, x1 + 7 - 1, 142 + 5, RGB565_COLOR_WHITE);
        x1 += 8;
        disp_draw_rect_color(x1, 142 + 5, x1 + 7 - 1, 142 + 5, RGB565_COLOR_WHITE);
    }
    else
    {
        disp_draw_user_image_num_mid_filter_color(208, 142, heart_rate, 8, num_7x10_TAB);
    }
    int temperature_int = round(temperature);
    int const digits = get_num_digit(temperature_int);
    int const width = digits * 8 - 1 + 14;
    int x = 179 + (58 - width) / 2;
    int y = 213;
    if (temperature_int < 0)
    {
        disp_draw_rect_color(x, y + 4, x + 7 - 1, y + 4, RGB565_COLOR_WHITE);
        x += 8;
        temperature_int = -temperature_int;
    }
    x = disp_draw_user_image_num_filter_color(x, y, temperature_int, 8, num_7x10_TAB) - 1;
    x += 1;
    if (disp_ctrl.com_data.i_temp[21] == WEATHER_TEMPERATURE_TYPE_C)
    {
        disp_draw_user_image(x, y, icon_centigrade);
    }
    else
    {
        disp_draw_user_image(x, y, icon_fahrenheit);
    }
    disp_draw_user_image_num_mid_filter_color(208, 70, steps, 8, num_7x10_TAB);
}
#endif
